Skip to content

feat: add theme.shapes and cornersToStyle#4919

Open
adrcotfas wants to merge 1 commit into@adrcotfas/refactor/tokens_statefrom
@adrcotfas/refactor/tokens_shape
Open

feat: add theme.shapes and cornersToStyle#4919
adrcotfas wants to merge 1 commit into@adrcotfas/refactor/tokens_statefrom
@adrcotfas/refactor/tokens_shape

Conversation

Adds the 10 MD3 shape scale tokens to theme.shapes.*, ShapeCorners for directional variants, and cornersToStyle() for mapping to RN style props. Deprecates theme.roundness in favour of theme.shapes.
@callstack-bot
Copy link
Copy Markdown

Hey @adrcotfas, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 5, 2026

The mobile version of example app from this branch is ready! You can see it here.

Comment thread src/theme/types/theme.ts
Comment on lines +13 to 14
/** @deprecated Use `theme.shapes.*` instead. Will be removed in a future version. */
roundness: number;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't keep deprecated values in the theme. It makes things more complicated for components. If there is a replacement, drop the old one.

Comment thread src/index.tsx
export { default as PaperProvider } from './core/PaperProvider';
export { default as shadow } from './theme/shadow';
export { default as configureFonts } from './theme/fonts';
export { cornersToStyle } from './theme/tokens/sys/shape';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't expose such tiny utilities. Keep the library public API surface small. It's very straightforward for users to write such utility themselves, should they need it.

import type { ShapeCorners, ThemeShapes } from '../../types';

export const defaultShapes: ThemeShapes = {
none: 0,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think it makes sense to expose none as a customizable theme value. It'll always be 0.

extraLarge: 28,
extraLargeIncreased: 32,
extraExtraLarge: 48,
full: 9999,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as none. Don't think it makes sense to expose it as a customizable theme value.

Comment thread src/theme/types/theme.ts
colors: ThemeColors;
fonts: Typescale;
state: ThemeState;
shapes: ThemeShapes;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about the name "shapes". It says "shapes" but it exposes roundness/border radius values, not actual shapes, so the name is confusing.

Comment thread src/theme/types/shape.ts
Comment on lines +1 to +6
export type ShapeCorners = {
topStart: number;
topEnd: number;
bottomStart: number;
bottomEnd: number;
};
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we need this. Isn't this just style properties?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants